package webbrow.aop.model;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;

public class StatisticDaoImpl implements StatisticDao {
	private SqlSessionTemplate sqlsessionTemplate;
	private StatisticDaoImpl(SqlSessionTemplate sqlsessionTemplate){
		this.sqlsessionTemplate = sqlsessionTemplate;
	}
	
	@Override
	public void insertMemberRank(String id) throws SQLException {
		sqlsessionTemplate.insert("statistic.insertMemberRank",id);
		
	}

	@Override
	public int updateMemberRank(String id) throws SQLException {
		return sqlsessionTemplate.update("statistic.updateMemberRank", id);
	}

	@Override
	public List selectMemberRank() throws SQLException {
		return sqlsessionTemplate.selectList("statistic.selectMemberRank");
	}

	/**
	 * member_rank에 id 유무를 확인해주는 메소드
	 */
	@Override
	public int selectMemeberById(String id) throws SQLException {
		return sqlsessionTemplate.selectOne("statistic.selectMemeberById", id);
	}

}
